import io from 'socket.io-client';
import store from '../store/store';
import { setRoomId, setParticipants, setSocketId } from '../store/actions';
import Config from "../config";

const SERVER = Config.url;

let socket = null;

export const connectWithSocketIOServer = () => {
    socket = io(SERVER);
    socket.on('connect', () => {
        console.log('成功连接到socket.io 服务器');
        console.log(socket.id);
        store.dispatch(setSocketId(socket.id));
    });
    
};
